<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:gui="clr-namespace:DentalGUIHelper;assembly=DentalConfig"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

    <Style x:Key="IconToggleButton" TargetType="{x:Type gui:ImageAndTextToggleButton}">
        <Setter Property="BorderBrush" Value="{DynamicResource WhiteBrush}" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="FontSize" Value="{DynamicResource NormalFontSize}" />
        <Setter Property="FontFamily" Value="{DynamicResource BoldFontFamily}" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="TextDock" Value="Bottom" />
        <Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
        <Setter Property="Background" Value="{DynamicResource BrandBrush2}" />
        <Setter Property="Width" Value="Auto" />
        <Setter Property="Height" Value="Auto" />     
        <Setter Property="ContentWidth" Value="20" />
        <Setter Property="ContentHeight" Value="20" />     
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type gui:ImageAndTextToggleButton}">
                    <DockPanel Background="Transparent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                    <Viewbox x:Name="iconContainer" Margin="{TemplateBinding Padding}" DockPanel.Dock="Top" Width="{TemplateBinding ContentWidth}" Height="{TemplateBinding ContentHeight}"  Visibility="{TemplateBinding ShowContent, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Rectangle x:Name="rectangle" Width="{TemplateBinding ContentWidth}" Height="{TemplateBinding ContentHeight}" Fill="{TemplateBinding Foreground}">
                            <Rectangle.OpacityMask>
                                <VisualBrush>
                                    <VisualBrush.Visual>
                                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    </VisualBrush.Visual>
                                </VisualBrush>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </Viewbox>
                    </DockPanel>

                    <ControlTemplate.Triggers>                        
                        <Trigger Property="IsMouseOver" Value="True" >
                            <Setter Property="Opacity" Value="0.8" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="rectangle" Property="Fill" Value="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}" />
                            <Setter Property="Opacity" Value="1" />
                        </Trigger>
						<Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="rectangle" Property="Fill" Value="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}" />
                            <Setter Property="Opacity" Value="1" />
                        </Trigger>
						
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.5" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>
